home *** CD-ROM | disk | FTP | other *** search
/ NBC Slam Jams! / NBC Slam Jams!.iso / xtras / media_la / fx_set_1.fxm / 00022_Script_Utility Scripts < prev    next >
Text File  |  1998-01-20  |  6KB  |  185 lines

  1. -- Standard button handler will use a "down" member and return TRUE for a good click
  2. on ButtonHandler sNum
  3.   if not sNum then set sNum = the clickOn
  4.   if sNum < 1 then return(FALSE)
  5.   set mNum = the memberNum of sprite sNum
  6.   if mNum < 0 then exit
  7.   
  8.   set mName = the name of member mNum
  9.   if not stringP(mName) then exit
  10.   
  11.   set the member of sprite sNum = member (mName&&"down")
  12.   set click = TRUE
  13.   updateStage
  14.   
  15.   repeat while the mouseDown
  16.     if rollover(sNum) then
  17.       set the member of sprite sNum = member (mName&&"down")
  18.       set click = TRUE
  19.     else
  20.       set the member of sprite sNum = member (mName)
  21.       set click = FALSE
  22.     end if
  23.     updateStage
  24.   end repeat
  25.   
  26.   if click then
  27.     set the member of sprite sNum = member (mName)
  28.     updateStage
  29.     return TRUE
  30.   else
  31.     return FALSE
  32.   end if
  33. end
  34.  
  35. -- Puppet some sprites so that hold on through frame changes
  36. on holdPuppets a, b
  37.   repeat with i = a to b
  38.     puppetSprite i, TRUE
  39.   end repeat
  40. end
  41.  
  42. -- Turn off puppets of some sprites so they can change with next update
  43. on releasePuppets a, b
  44.   repeat with i = a to b
  45.     puppetSprite i, FALSE
  46.   end repeat
  47. end
  48.  
  49. -- Remove effects from display member
  50. on resetDisplay
  51.   global fxDisplayMember
  52.   preLoad (member fxDisplayMember)
  53.   RemoveAllEffects(member fxDisplayMember)
  54. end
  55.  
  56. -- Add 70 pixels to the window size so the user can see the help field
  57. on ExpandWindow
  58.   global fxWindow, fxHelp
  59.   set r = the rect of fxWindow
  60.   set the bottom of r = (the top of r) + 300
  61.   set the rect of fxWindow = r
  62.   set the picture of member "helpButton" = the picture of member "helpButton on"
  63.   set fxHelp = TRUE
  64. end
  65.  
  66. -- Take window to normal size
  67. on CollapseWindow
  68.   global fxWindow, fxHelp
  69.   set r = the rect of fxWindow
  70.   set the right of r = (the left of r) + 528
  71.   set the bottom of r = (the top of r) + 230
  72.   set the rect of fxWindow = r
  73.   set the picture of member "helpButton" = the picture of member "helpButton off"
  74.   set fxHelp = FALSE
  75. end
  76.  
  77. -- OK button pressed
  78. -- Set stage member and close window
  79. on OK
  80.   global fxTrackingObj  
  81.   setMemberEffects(fxTrackingObj)  
  82.   Cancel(0)
  83. end
  84.  
  85. -- Settings window goes back to General Settings page
  86. on Settings
  87.   if objectP(fxCurObj) then
  88.     release(fxCurObj)
  89.   end if
  90.   go to frame "General Member Settings"
  91. end
  92.  
  93. -- About button goes to about page
  94. on About
  95.   if objectP(fxCurObj) then
  96.     release(fxCurObj)
  97.   end if
  98.   go to frame "About"
  99. end
  100.  
  101. -- Cancel button closes the window
  102. on Cancel cleanUp
  103.   global fxTrackingObj, fxCurObj
  104.   if objectP(fxCurObj) then Release(fxCurObj)
  105.   if objectP(fxTrackingObj) then clearTests(fxTrackingObj)
  106.   if cleanUp then resetProperties(fxTrackingObj)
  107.   set fxTrackingObj = 0
  108.    closeWindow -- artificial call to closeWindow
  109.   tell the stage to updateStage
  110. end
  111.  
  112.  
  113. -- Check to make sure effect is present
  114. on VerifySpriteEffect sNum, fxSym
  115.   if the type of member the castNum of sprite sNum = #alpha then
  116.     set fxl = GetEffectList(sprite sNum)
  117.     set pos = GetPos(fxl, fxSym)
  118.     return(pos)
  119.   end if
  120.   return(false)
  121. end
  122.  
  123. -- Swap out sprite members to make them look active or dimmed
  124. on enableInterfaceElement i, enabled
  125.   puppetSprite i, TRUE
  126.   if the memberNum of sprite i < 1 then exit
  127.   put the name of the member of sprite i into memname
  128.   if memname = "" then put the member of sprite i into memname
  129.   if enabled then       
  130.     if the type of the member of sprite i = #bitmap then
  131.       if the depth of member memname = 1 then
  132.         set the foreColor of sprite i = 255
  133.       else if memname contains "Dim" then
  134.         put word 1 to (the number of words in memname)-1 of memname into memname
  135.       end if
  136.       set the member of sprite i = member memname
  137.     else if the type of the member of sprite i = #shape then
  138.       if the shapeType of the member of sprite i = #line then
  139.         set the foreColor of sprite i = 255
  140.       end if
  141.     else if the type of the member of sprite i = #field then
  142.       if field memname = "" then put "--" into field memname
  143.       set the foreColor of field memname = textColor(#black)
  144.       if the ink of sprite i = 0 then
  145.         set the editable of sprite i = TRUE
  146.       end if
  147.     end if
  148.   else
  149.     if the type of the member of sprite i = #bitmap then
  150.       if the depth of member memname = 1 then
  151.         set the foreColor of sprite i = 249
  152.       else if memname contains "Dim" then
  153.         nothing
  154.       else if memname contains "Down" then
  155.         put word 1 to (the number of words in memname)-1 of memname into memname
  156.         put " Dim" after memname
  157.       else
  158.         put " Dim" after memname
  159.       end if
  160.       if the number of member memname > 0 then
  161.         set the member of sprite i = member memname
  162.       end if
  163.     else if the type of the member of sprite i = #shape then
  164.       if the shapeType of the member of sprite i = #line then
  165.         set the foreColor of sprite i = 249
  166.       end if
  167.     else if the type of the member of sprite i = #field then
  168.       if field memname = "" then put "--" into field memname
  169.       set the foreColor of field memname = textColor(#gray)
  170.       if the ink of sprite i = 0 then
  171.         set the editable of sprite i = FALSE
  172.       end if
  173.     end if
  174.   end if
  175.   updateSTage
  176. end
  177.  
  178. -- Use color field to produce text color number across palettes and color depths
  179. on textColor c
  180.   if c = #black then
  181.     return the foreColor of word 1 of field "textcolors"
  182.   else if c = #gray then
  183.     return the foreColor of word 2 of field "textcolors"
  184.   end if
  185. end